<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">


<ui:composition template="/templates/internal.xhtml">
	<ui:define name="center">

		<script type="text/javascript">
			$( document ).ready(function() {
				PF('wlayout').layout.hide('south');
				PF('wlayout').layout.open('west');
				
			});			
		</script>
	
		<p:outputPanel id="content" layout="block" style="height:100%;width:100%">
			<p:growl id="messages" showDetail="true"  />
			<ui:include src="/modality/modalityForm.xhtml"/>
		</p:outputPanel>
	</ui:define>
	<ui:define name="menu">
		<h:form id="listModalityForm" prependId="false">
			<p:dataTable id="modalitysTable" value="#{modalityBean.versionableModalitys}" var="versionableModality" paginator="true"  paginatorAlwaysVisible="false"  paginatorPosition="bottom" rows="15" emptyMessage="#{msgs.NoResults}">
				<p:columnGroup type="header">  
					<p:row>
						<p:column colspan="4">
							<f:facet name="header">
								<h:outputText value="#{msgs.Modalitys}" />
							</f:facet>
						</p:column>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Filter}" update=":findModality" icon="ui-icon-search" oncomplete="PF('wfindModality').show()" styleClass="ui-table-button"/>
							</f:facet>
						</p:column>
					</p:row>
					<p:row>
						<p:column colspan="1" styleClass="ui-table-button-row">
							<f:facet name="header">
								<p:commandButton title="#{msgs.Add}"	action="#{modalityBean.toAddModality}" update=":content"	 icon="ui-icon-plus" styleClass="ui-table-button" oncomplete="wtabModality.select(0);"/>
							</f:facet>
						</p:column>
						<p:column	colspan="1">
							<f:facet name="header">
								<h:outputText value="#{msgs.Name}"/>
							</f:facet>
						</p:column>
						<p:column style="max-width:12px"	colspan="3" >
							<f:facet name="header">
								<h:outputText value="#{msgs.Version}"/>
							</f:facet>
						</p:column>

					</p:row>	
				</p:columnGroup>
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row"  > 
					<p:commandButton title="#{msgs.View}" action="#{modalityBean.toViewVersionableModality}"   icon="ui-icon-search"  styleClass="ui-table-button" update=":content" oncomplete="wtabModality.select(0);">
						<f:setPropertyActionListener target="#{modalityBean.versionableModality}" value="#{versionableModality}"/>
					</p:commandButton>
				</p:column>
				<p:column colspan="1"  >
					<h:outputText value="#{versionableModality.modality.name}" />
				</p:column>
				<p:column colspan="2" style="padding:1px;max-width:30px"  >
					<p:selectOneMenu value="#{versionableModality.modality}" converter="#{genericConverter}"  style="white-space: nowrap;"  
						panelStyle="max-width:30px;"	styleClass="ui-selector-on-table"  >
						<f:selectItems value="#{versionableModality.modalityVersions}" var="modalityVersion"  
							itemLabel="#{modalityVersion.version}" itemValue="#{modalityVersion}"/>
						<p:ajax  update=":listModalityForm:modalitysTable" />
					</p:selectOneMenu>
				</p:column>
				<p:column colspan="1" styleClass="ui-widget-header ui-table-button-row" >
					<p:commandButton title="#{msgs.Delete}" process="@this" oncomplete="wconfExcMod.show();" update=":deleteModalityDialog"  icon="ui-icon-trash" styleClass="ui-table-button">
						<f:setPropertyActionListener target="#{modalityBean.versionableModality}" value="#{versionableModality}"/> 
					</p:commandButton>
				</p:column>	
			</p:dataTable>			
		</h:form>
	</ui:define>

	<ui:define name="dialogs">
		<ui:include src="/modality/modalityDialogs.xhtml"/>
	</ui:define>
</ui:composition>
	
</html>